#$ARGV[0] is the 0/1 log file.

$file = $ARGV[0];

@pathname = split(/\\/,$file);
$len = @pathname;
$path;
print "$len\n";
for($i=$len-2;$i>=0;$i--){
	$path = "$pathname[$i]\\"."$path";
	print "path $path\n";
}

$counter = 0;
$fileName="totalSyncFormat.info";
open fout, ">$path\\$fileName" or die "can not open file $path\\$fileName\n";
open fin, "<$file" or die "can not open file $file!\n";
	while (<fin>) {
		chomp;
		@info = split;

		$length = @info;
		
		if($info[0]>0){
			print fout "\n";
			if ($counter!=17){
				print "wrong!\n";
			}
			$counter=0;
			for($i=0;$i<$length;$i++){
				print fout "$info[$i] ";
				$counter++;
			}
		}
		if($info[0]<0) {
			for($i=0;$i<$length;$i++){
				print fout "$info[$i] ";
				$counter++;
			}
		}
	}
close fin;
close fout;